/// @tags: Stiring
#include <algorithm>
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long ll;

int const N = 5e3 + 5, P = 1e9 + 7;

int n, k;
int fac[N], inv[N], S[N][N];

inline ll qpow(ll base, int exp) {
  ll Res = 1;
  while (exp) {
    if (exp & 1) Res = Res * base % P;
    base = base * base % P;
    exp >>= 1;
  }
  return Res;
}

inline int main() {
  cin >> n >> k;
  int lim = min(k, n);
  fac[0] = 1;
  for (int i = 1; i <= lim; ++i) fac[i] = (ll)fac[i - 1] * i % P;
  inv[lim] = qpow(fac[lim], P - 2);
  for (int i = lim - 1; i >= 0; --i) inv[i] = (ll)inv[i + 1] * (i + 1) % P;
  S[0][0] = 1;
  for (int i = 1; i <= k; ++i) {
    for (int j = 1; j <= k; ++j) {
      S[i][j] = (ll)S[i - 1][j] * j % P + S[i - 1][j - 1];
      if (S[i][j] >= P) S[i][j] -= P;
    }
  }
  ll ans = 0, tmp = 1;
  for (int i = 0; i <= lim; ++i) {
    if ((ans += S[k][i] * tmp % P * qpow(2, n - i) % P) >= P) ans -= P;
    tmp = tmp * (n - i) % P;
  }
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("CF932E Team Work.in", "r", stdin);
  freopen("CF932E Team Work.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
